package com.v.LogOutPutFormat;

import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.io.NullWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Reducer;

import java.io.IOException;

public class LogReducer extends Reducer<Text, NullWritable, Text, NullWritable> {
    @Override
    protected void reduce(Text key, Iterable<NullWritable> values, Reducer<Text, NullWritable, Text, NullWritable>.Context context) throws IOException, InterruptedException {

        //这里需要注意，当同一个网址同时进入的时候需要循环遍历values
        //增强for循环强调的是一个个读取存入，而和普通for循环强调数量是不一样的
        for (NullWritable value : values) {
            context.write(key, value);
        }

    }
}

